const q = (css, p = document) => p.querySelector(css);
const getExtName = url => {
	let i, n = url.indexOf('?', 21);
	if (-1 != n) i = n-3;
	else {
		i = url.length - 4;
		n = void 0;
	}
	i = url.lastIndexOf('.',i) +1;
	if (i) return url.slice(i, n);
};
const getPlayType = (url) => {
	const ext = getExtName(url);
	if (/mp4|ogg|webm/.test(ext)) return 'normal';
	if (ext == 'm3u8') return 'hls';
	if (ext == 'flv') return 'flv';
	if (ext == 'mpd') return 'dash';
	if (url.includes('/hls/', 11) || url.includes('m3u8', 7)) return 'hls';
	if (url.includes('.mp4', 25)) return 'normal';
	if (url.includes('.mpd', 25)) return 'dash';
	return 'auto';
};
// https://api.dogecloud.com/player/get.flv?vcode=5ac682e6f8231991&userId=17&ext=.flv  https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd
const createPlayer = (v, url, type = 'auto') => {
	if (!type || type == 'auto') type = getPlayType(url);
	new DPlayer({
		video: { url, type },
		theme: "#00B3FF",
		autoplay: true,
		screenshot: true,
		container: v
	});
};
const mvUrl = location.hash.slice(1);
const vType = location.search.slice(7);
createPlayer(q('#player'), mvUrl, vType);